package com.rr.streamrabbitmqnew.controller;

import com.rr.streamrabbitmqnew.service.SendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhuangcanrun
 * @Date 2021/06/17/9:46
 * @description
 **/

@RestController
public class StreamController {

    @Autowired
    private SendService sendService;

    @GetMapping("/send/{message}")
    public String send(@PathVariable("message") String message) {
        sendService.sendMessageToSend(message);
        return message;
    }

    @GetMapping("/sendDestinationAndMessage/{destinationAndMessage}")
    public String sendMessageWithDestination(@PathVariable("destinationAndMessage") String destinationAndMessage) {
        sendService.send(destinationAndMessage);
        return destinationAndMessage;
    }
}
